<?php 
/*
 * 即时聊天工具
 * @package    
 * @author     Mark
 * @copyright  Copyright (c) 2013 ixdcw team
 * @version    $Id: 761079c19b7996a1de9aafe44eb006a1830e4b8d $
 */
defined('IN_IXDCW') or exit('Access Denied');
class Im
{
	public static function web($id) {
		if (is_numeric($id)) {
			$user = userinfo($id, '', '*', 'userid');
		} else {
			$user = userinfo($id);
		}
		if ($user) {
			$online = online($user['userid']);
		}
		if ($online) {
			return '<a class="icon-talk-online" href="'.url('member/chat', 'touser='.$user['username']).'" target="_blank" rel="nofollow"></a>';
		} else {
			return '<a class="icon-talk-offline" href="'.url('member/message', 'action=send&touser='.$user['username']).'" target="_blank" rel="nofollow"></a>';
		}
	}

	public static function qq($id) {
		return $id ? '<a href="http://wpa.qq.com/msgrd?v=3&uin='.$id.'&site=qq&menu=yes" target="_blank" rel="nofollow"><img src="http://wpa.qq.com/pa?p=1:'.$id.':4" title="点击QQ交谈/留言" align="absmiddle" onerror="this.src=DTPath+\'file/image/qq-off.gif\'"/></a>' : '';
	}

	public static function ali($id) {
		return $id ? '<a href="http://amos.im.alisoft.com/msg.aw?v=2&uid='.$id.'&site=cnalichn&s=6" target="_blank" rel="nofollow"><img src="http://amos.im.alisoft.com/online.aw?v=2&uid='.$id.'&site=cnalichn&s=6" title="点击旺旺交谈/留言" align="absmiddle" onerror="this.src=DTPath+\'file/image/ali-off.gif\'" onload="if(this.width>20)this.src=SKPath+\'image/ali-off.gif\'"/></a>' : '';
	}

	public static function msn($id) {
		return $id ? '<a href="msnim:chat?contact='.$id.'" rel="nofollow"><img src="'.SITE_URL.'file/image/msn.gif" width="16" height="16" title="点击MSN交谈/留言" align="absmiddle"/></a>' : '';
	}

	public static function skype($id) {
		return $id ? '<a href="skype:'.$id.'" rel="nofollow"><img src="http://mystatus.skype.com/smallicon/'.$id.'" title="点击Skype通话" align="absmiddle" onerror="this.src=DTPath+\'file/image/skype-off.gif\'"/></a>' : '';
	}

}